<?php
declare (strict_types = 1);

namespace app\common\model;

use think\Model;

/**
 * @mixin \think\Model
 * 客户申请
 */
class Customer extends BaseModel
{
    //

    //更新后
    public static function onAfterUpdate($model)
    {
        if(intval($model['type']) == PublicStatus::PUBLIC_STATUS_ONE){
            $order = Order::where(['order_no'=>$model['order_sn']])->find();
            if ($order) {
               $order->user_id =$model['user_id'];
               $order->save();
            }
        }
    }



    public function user()  {
        return $this->belongsTo(User::class,'user_id');
    }



}
